home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dbcexe
/
frmnames.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1999-03-30
|
10KB
|
318 lines
VERSION 5.00
Begin VB.Form frmNames
BorderStyle = 3 'Fixed Dialog
Caption = "Names"
ClientHeight = 2775
ClientLeft = 45
ClientTop = 330
ClientWidth = 5850
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2775
ScaleWidth = 5850
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdName
Height = 375
Index = 0
Left = 2265
Picture = "frmNames.frx":0000
Style = 1 'Graphical
TabIndex = 17
TabStop = 0 'False
ToolTipText = "New"
Top = 2190
Width = 375
End
Begin VB.CommandButton cmdName
Height = 375
Index = 1
Left = 2625
Picture = "frmNames.frx":0216
Style = 1 'Graphical
TabIndex = 16
ToolTipText = "Save"
Top = 2190
Width = 375
End
Begin VB.CommandButton cmdName
Height = 375
Index = 2
Left = 2985
Picture = "frmNames.frx":04C0
Style = 1 'Graphical
TabIndex = 15
ToolTipText = "Cancel"
Top = 2190
Width = 375
End
Begin VB.CommandButton cmdName
Height = 375
Index = 3
Left = 3345
Picture = "frmNames.frx":07D2
Style = 1 'Graphical
TabIndex = 14
TabStop = 0 'False
ToolTipText = "Delete"
Top = 2190
Width = 375
End
Begin VB.CommandButton cmdName
Height = 375
Index = 4
Left = 3705
Picture = "frmNames.frx":095C
Style = 1 'Graphical
TabIndex = 13
TabStop = 0 'False
ToolTipText = "Next"
Top = 2190
Width = 375
End
Begin VB.CommandButton cmdName
Height = 375
Index = 5
Left = 1905
Picture = "frmNames.frx":0A2E
Style = 1 'Graphical
TabIndex = 12
TabStop = 0 'False
ToolTipText = "Previous"
Top = 2190
Width = 375
End
Begin VB.TextBox txtForm
Height = 285
Index = 5
Left = 1785
TabIndex = 10
Top = 1695
Width = 2550
End
Begin VB.TextBox txtForm
Height = 285
Index = 4
Left = 1785
TabIndex = 4
Top = 1395
Width = 2550
End
Begin VB.TextBox txtForm
Height = 285
Index = 3
Left = 1785
TabIndex = 3
Top = 1095
Width = 2550
End
Begin VB.TextBox txtForm
Height = 285
Index = 2
Left = 1785
TabIndex = 2
Top = 795
Width = 2550
End
Begin VB.TextBox txtForm
Height = 285
Index = 1
Left = 1785
TabIndex = 1
Top = 495
Width = 2550
End
Begin VB.TextBox txtForm
Enabled = 0 'False
Height = 285
Index = 0
Left = 1785
TabIndex = 0
Top = 180
Width = 2550
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "State"
Height = 255
Index = 5
Left = 840
TabIndex = 11
Top = 1710
Width = 1470
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "City"
Height = 255
Index = 4
Left = 840
TabIndex = 9
Top = 1410
Width = 1470
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "Address"
Height = 255
Index = 3
Left = 840
TabIndex = 8
Top = 1110
Width = 1470
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "First Name"
Height = 255
Index = 2
Left = 840
TabIndex = 7
Top = 810
Width = 1470
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "Last Name"
Height = 255
Index = 1
Left = 840
TabIndex = 6
Top = 510
Width = 1470
End
Begin VB.Label lblForm
BackStyle = 0 'Transparent
Caption = "ID"
Height = 255
Index = 0
Left = 840
TabIndex = 5
Top = 195
Width = 1470
End
Attribute VB_Name = "frmNames"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private oNames As Names
Private bLoaded As Boolean
'------------------------------------------------------------------------'
Private Sub cmdName_Click(Index As Integer)
Select Case Index
Case 0 '--New
With oNames
If cmdName(1).Enabled Then
.IsNew = False
.Save
End If
Call .Add
End With
cmdName(1).Enabled = True
cmdName(2).Enabled = True
Case 1 '--Save
oNames.IsNew = False
Call oNames.Save
cmdName(1).Enabled = False
cmdName(2).Enabled = False
Case 2 '--Cancel
Unload Me
Exit Sub
Case 3 '--Delete
With oNames
Call .Delete(.ID)
'-- if no records are left, then you need to display a blank record
If Not .MoveFirst Then Call .Add
End With
cmdName(1).Enabled = False
cmdName(2).Enabled = False
Case 4 '--Next
If cmdName(1).Enabled Then
oNames.IsNew = False
oNames.Save
Else
oNames.CancelUpdate
End If
If Not oNames.MoveNext Then Call oNames.MoveLast
cmdName(1).Enabled = False
cmdName(2).Enabled = False
Case 5 '--Previous
If cmdName(1).Enabled Then
oNames.IsNew = False
oNames.Save
Else
oNames.CancelUpdate
End If
If Not oNames.MovePrevious Then Call oNames.MoveFirst
cmdName(1).Enabled = False
cmdName(2).Enabled = False
End Select
Call FillForm(oNames.ID)
txtForm(1).SetFocus
End Sub
'------------------------------------------------------------------------'
Private Sub Form_Activate()
With oNames
.Filter = "ORDER BY LName"
.Requery
If Not .MoveFirst Then
.Add
.Save
.MoveFirst
End If
End With
Call FillForm(oNames.ID)
txtForm(1).SetFocus
End Sub
'------------------------------------------------------------------------'
Private Sub Form_Load()
Set oNames = New Names
End Sub
'------------------------------------------------------------------------'
Private Sub Form_Unload(Cancel As Integer)
oNames.CancelUpdate
Set oNames = Nothing
Call EndApp
End Sub
'------------------------